package com.example.service;

import com.example.entity.Clockcalendar;
import com.example.entity.HistoryPeople;
import com.example.mapper.ClockcalendarMapper;
import com.example.mapper.HistoryPeopleMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/*
用户打卡日历业务处理
 */
@Service
public class ClockcalendarService {

    @Resource
    private ClockcalendarMapper clockcalendarMapper;

    public void add(Clockcalendar clockcalendar) {
        clockcalendarMapper.insert(clockcalendar);
    }

    public void deleteById(Integer id) {
        clockcalendarMapper.deleteById(id);
    }

    public void deleteBatch(List<Integer> ids) {
        for (Integer id : ids){
            this.deleteById(id);
        }
    }

    public void updateById(Clockcalendar clockcalendar) {
        clockcalendarMapper.updateById(clockcalendar);
    }

    public Clockcalendar selectById(Integer id) {
        return clockcalendarMapper.selectById(id);
    }
    public Clockcalendar selectByDate(String calendar) {
        return clockcalendarMapper.selectByDate(calendar);
    }



    public List<Clockcalendar> selectAll(Clockcalendar clockcalendar) {
        return clockcalendarMapper.selectAll(clockcalendar);
    }

    public PageInfo<Clockcalendar> selectPage(Clockcalendar clockcalendar, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Clockcalendar> clockcalendarList = clockcalendarMapper.selectAll(clockcalendar);
        return PageInfo.of(clockcalendarList);
    }
}
